package dtd.PHS.VND_ExchangeRate.ui.gesture;

import android.os.Bundle;
import android.view.MotionEvent;
import dtd.PHS.VND_ExchangeRate.VNExActivity;

abstract public class GestureActivity 
	extends VNExActivity 
	implements SimpleGestureListener {
	
	SimpleGestureFilter detector;
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		detector = new SimpleGestureFilter(this, this);
	}
	
	@Override 
	public boolean dispatchTouchEvent(MotionEvent me){ 
		this.detector.onTouchEvent(me);
		return super.dispatchTouchEvent(me); 
	}
	
	
	@Override
	public void onSwipe(int direction) {
		switch (direction) {
		case SimpleGestureFilter.SWIPE_LEFT:
			onSwipeLeft();
			break;
		case SimpleGestureFilter.SWIPE_RIGHT:
			onSwipeRight();
			break;
		default:
			break;
		}

	}

	protected abstract void onSwipeRight();
	protected abstract void onSwipeLeft();
}
